package com.yxym.poly;

public class PloyMethod {
    public static void main(String[] args) {
        A a = new A();
        a.say();
        //方法重载体现多态
        B b = new B();
        b.say();
        System.out.println(a.sum(5,6));
        System.out.println("==========");
        System.out.println(a.sum(6,8,9));
    }
}
class B {
    public void say(){
        System.out.println("B say()方法被调用...");
    }
}
class A extends B {
    public void say(){
        System.out.println("A类的say()方法被调用...");
    }
    public int sum(int n1 ,int n2){//和下面的sum构成方法重载
        return n1 + n2;
    }
    public int sum(int n1 , int n2 ,int n3){
        return n1 + n2 + n3 ;
    }
}